package cn.iocoder.yudao.module.resource.api;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.resource.api.enums.UserTimeTransactionTypeEnum;
import cn.iocoder.yudao.module.resource.api.model.usertimetransaction.UserTimeTransactionDTO;
import cn.iocoder.yudao.module.resource.api.model.usertimetransaction.UserTimeTransactionPageReqDTO;
import cn.iocoder.yudao.module.resource.controller.admin.usertimetransaction.vo.UserTimeTransactionPageReqVO;
import cn.iocoder.yudao.module.resource.service.usertimetransaction.UserTimeTransactionService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserTimeTransactionApiImpl implements IUserTimeTransactionApi {
    @Resource
    private UserTimeTransactionService userTimeTransactionService;


    @Override
    public UserTimeTransactionDTO getUserTimeTransaction(Long userId, String id) {
        return BeanUtils.toBean(userTimeTransactionService.getUserTimeTransaction(id), UserTimeTransactionDTO.class);
    }

    @Override
    public PageResult<UserTimeTransactionDTO> getUserTimeTransactionPage(UserTimeTransactionPageReqDTO pageReqVO) {
        return BeanUtils.toBean(userTimeTransactionService.getUserTimeTransactionPage(BeanUtils.toBean(pageReqVO, UserTimeTransactionPageReqVO.class)), UserTimeTransactionDTO.class);
    }

    @Override
    public List<UserTimeTransactionDTO> getUserTimeTransactionByType(Long userId, UserTimeTransactionTypeEnum transactionType) {
        return BeanUtils.toBean(userTimeTransactionService.getUserTimeTransactionByType(userId, transactionType), UserTimeTransactionDTO.class);
    }

    @Override
    public Boolean hasUserTimeTransactionByType(Long userId, UserTimeTransactionTypeEnum transactionType) {
        return userTimeTransactionService.hasUserTimeTransactionByType(userId, transactionType);
    }

}
